<div class="container">
  <ol class="breadcrumb">
    <li><%= link_to 'Home', root_path %></li>
    <li><%= link_to 'Groups', group_users_path %></li>
    <li class="active">Group</li>
  </ol>
</div>

<%= render 'info' %>

<br/>


<div class="container">

  <div class="media">
    <% if @userLists.empty? %>
        <div class="alert alert-warning">
          Currently no user in this group.
        </div>
    <% else %>

        <div class="panel panel-default">
          <div class="panel-heading">
            <h4>Listing users in group</h4>
          </div>

            <table class="table table-hover">

              <thead>
              <tr>
                <th>#</th>
                <th>Email</th>
              </tr>
              </thead>

              <tbody>
              <% i = 1 %>
              <% @userLists.each do |userList| %>
                  <tr>
                    <td><%= i %></td>
                    <td><%= userList.email %></td>

                    <td><%= link_to 'Add', org_group_user_path(@group_user.id, userList.id), method: :post, class: "btn btn-success"%></td>
                  </tr>
                  <% i = i + 1 %>
              <% end %>
              </tbody>
            </table>
        </div>
    <% end %>
  </div>


  <div class="media">
    <% if @addedUserLists.empty? %>
        <div class="alert alert-warning">
          Currently no added user in this group.
        </div>
    <% else %>

        <div class="panel panel-default">
          <div class="panel-heading">
            <h4>Listing added users in group</h4>
          </div>
            <table class="table table-hover">
              <thead>
              <tr>
                <th>#</th>
                <th>Email</th>
              </tr>
              </thead>
              <tbody>
              <% i = 1 %>
              <% @addedUserLists.each do |userList| %>
                  <tr>
                    <td><%= i %></td>
                    <td><%= userList.email %></td>

                    <td><%= link_to 'Remove', destroy_org_group_user_path(@group_user.id, userList.id), method: :delete, class: "btn btn-xs btn-danger" %></td>
                  </tr>
                  <% i = i + 1 %>
              <% end %>
              </tbody>
            </table>
        </div>
    <% end %>
  </div>
</div>